﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Windy.TurtleDrawing.Samples
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            StreamGeometry geometry = new StreamGeometry();

            using (var Turtle = geometry.CreateTurtle(new Point(50, 50)))
            {
                int count = 5;
                double angle = Math.PI * 2 / count;
                Turtle.IsPloting = true;

                for (int fo = 0; fo < count; fo++)
                {

                    Turtle.MoveForward(20);
                    Turtle.Turn(angle);
                }

                //Turtle.TurnTo(0);
                //Turtle.MoveForward(20);
                //Turtle.Turn(Math.PI / 2);
                //Turtle.MoveForward(20);
                //Turtle.Turn(Math.PI / 2);
                //Turtle.MoveForward(20);
            }
            
            geometry.Freeze();

            //Path path = new Path();
            //path.Data = geometry;
            //path.Stroke = Brushes.Black;
            //path.StrokeThickness = 2;

            //this.Canvas.Children.Add(path);
            this.Drawing.Data = geometry;
        }
    }
}
